/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Anthares
 */
@Entity
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Langue.findAll", query = "SELECT l FROM Langue l"),
    @NamedQuery(name = "Langue.findByLangId", query = "SELECT l FROM Langue l WHERE l.langId = :langId")})
public class Langue implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "LANG_ID", nullable = false, length = 255)
    private String langId;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "langue")
    private List<TradProd> tradProdList;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "langue")
    private List<TradCateg> tradCategList;

    public Langue() {
    }

    public Langue(String langId) {
        this.langId = langId;
    }

    public String getLangId() {
        return langId;
    }

    public void setLangId(String langId) {
        this.langId = langId;
    }

    @XmlTransient
    public List<TradProd> getTradProdList() {
        return tradProdList;
    }

    public void setTradProdList(List<TradProd> tradProdList) {
        this.tradProdList = tradProdList;
    }

    @XmlTransient
    public List<TradCateg> getTradCategList() {
        return tradCategList;
    }

    public void setTradCategList(List<TradCateg> tradCategList) {
        this.tradCategList = tradCategList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (langId != null ? langId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Langue)) {
            return false;
        }
        Langue other = (Langue) object;
        if ((this.langId == null && other.langId != null) || (this.langId != null && !this.langId.equals(other.langId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Model.Langue[ langId=" + langId + " ]";
    }
    
}
